package com.college.library;

import java.lang.annotation.Annotation;
import java.lang.reflect.Constructor;
import java.lang.reflect.Method;

import com.custom.collegeannotation.CollegeDetails;

public class Test {
	public static void main(String[] args) {
		Library library = new Library("naveen", "hyd", "banglore");
		library.getDetails();
		Class<? extends Library> c = library.getClass();
		System.out.println(c);
		CollegeDetails cg = c.getAnnotation(CollegeDetails.class);
		System.out.println(cg);
		System.out.println("class::" + cg.value());
		// c.getAnnotation(Class<A> CollegeDetails.class);
		// System.out.println(o);
		Constructor<Library>[] cc = (Constructor<Library>[]) c
				.getConstructors();

		for (Constructor<Library> l : cc) {
			Annotation[] a = l.getAnnotations();
			for (Annotation aa : a) {
				// System.out.println(((CollegeDetails)aa).name());
			}

		}

		/*
		 * Annotation[] annon=c.getAnnotations();
		 * //System.out.println(annon[0]); for(Annotation ann:annon) {
		 * System.out.println(((CollegeDetails)ann).name());
		 * 
		 * }
		 */

		Method[] m = c.getMethods();
		for (Method mm : m) {

			Annotation[] a = mm.getDeclaredAnnotations();
			for (Annotation cd : a) {

				/*
				 * System.out.println(((CollegeDetails) cd).name());
				 * System.out.println(((CollegeDetails) cd).value());
				 */
			}

		}

		// System.out.println(d.name());
		// System.out.println(d.value());
	}

}
